package com.dd.duu.service.fallback;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.dc.entity.users.DUser;
import com.dd.duu.service.UserClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * 描述: 服务降级
 *
 * @author: yanglin
 * @Date: 2021-03-04-14:24
 * @Version: 1.0
 */
@Slf4j
public class UserFallBackFactory implements FallbackFactory<UserClient> {

    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public Page<DUser> queryUserList(int page, int row) {
                log.info("queryUserList 客户端服务降级");
                return null;
            }

            @Override
            public Integer insert(DUser user) {
                return null;
            }

            @Override
            public boolean updateById(DUser user) {
                return false;
            }

            @Override
            public boolean delete(Integer userId) {
                return false;
            }
        };
    }
}
